import React from "react";
import {SafeAreaView, TouchableOpacity, View, Text, Image} from "react-native";
import {icons, SIZES} from "../constants";

const tintColor = "#ffffffdd";

interface HeaderProps {
    goBack: () => void;
    title: string;
}

const Header = ({goBack, title}: HeaderProps) => {
    return (
        <SafeAreaView>
            <View
                style={{
                    flexDirection: "row",
                    alignItems: "center",
                    paddingHorizontal: SIZES.SPACE_S,
                    paddingVertical: 5,
                }}
            >
                <TouchableOpacity style={{marginLeft: 8}} onPress={goBack}>
                    <Image
                        source={icons.arrow_right}
                        resizeMode="contain"
                        style={{
                            width: 25,
                            height: 25,
                            tintColor,
                        }}
                    />
                </TouchableOpacity>
                <View style={{flex: 1, alignItems: "center", justifyContent: "center"}}>
                    <Text
                        style={{
                            ...{lineHeight: 39, fontSize: 24},
                            color: "#ffffffdd",
                            fontWeight: "bold",
                        }}
                    >
                        {title}
                    </Text>
                </View>
                <TouchableOpacity style={{marginRight: 8}} onPress={() => console.log("Click More")}>
                    <Image
                        source={icons.more}
                        resizeMode="contain"
                        style={{
                            width: 30,
                            height: 30,
                            tintColor,
                            alignSelf: "flex-end",
                        }}
                    />
                </TouchableOpacity>
            </View>
        </SafeAreaView>
    );
};

export default Header;
